<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@page import="com.market.datos.cDatos" %>

<%
            String anom = request.getParameter("anom");
            String aclave = request.getParameter("aclave");

            cDatos objCon = new cDatos();
            objCon.openConnection();
            String sql = "select count(*) as cant from administrador WHERE admin_nom='";
            sql += anom + "' AND admin_pass='" + aclave + "'";
                        
            Vector vr = objCon.query(sql);
            Vector v1 = (Vector) vr.get(0);
            String dato = (String) v1.get(0);
            int xcant = Integer.parseInt(dato);
            if (xcant > 0) {
                session.setAttribute("codigo", anom);
                session.setAttribute( "clave" , aclave );
                response.sendRedirect("admin_entorno.jsp"); 
            } else {
                request.setAttribute("xmsg", "Error: nombre o contraseña no válidos");
                request.getRequestDispatcher("admin.jsp").forward(request, response);
            //response.sendRedirect( "index.jsp");
            }
                      
%>
